package cn.wzvtc.demo.controller;

import cn.wzvtc.demo.common.dto.Result;
import cn.wzvtc.demo.model.vo.UserFormAnalyzeVO;
import cn.wzvtc.demo.service.UserFormAnalyzeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description 表单数据统计控制器
 * @author Supyo
 * @date 2021/7/8 14:28
 */
@RestController
public class UserFormAnalyzeController {

    @Autowired
    UserFormAnalyzeService userFormAnalyzeService;

    /**
     * 表单组件的数据统计
     * @param formId 表单编号
     * @param componentId 组件编号
     * @return 统计结果
     */
    @GetMapping("/result")
    public Result<UserFormAnalyzeVO> get(String formId, String componentId) {
//        FormResultEntity resultEntity = new FormResultEntity();
//        resultEntity.setForm_id("1");
//        resultEntity.setId("1");
//        resultEntity.setType("txt");
//        resultEntity.setTitle("填写人");
//        List<String> values = new ArrayList<>();
//        values.add("张三");
//        values.add("李四");
//        resultEntity.setValue(values);

        UserFormAnalyzeVO userFormAnalyzeVO = userFormAnalyzeService.returnValue(formId, componentId);
        return Result.success(userFormAnalyzeVO);
    }
}
